<--- %%NOBANNER%% --> indexc.sas
 BackForward

/*-------------------<---Start of Description-->---------------------\
| Return the first position of the character in the string;          |
|---------------------<---End of Description-->----------------------|
|--------------------------------------------------------------------|
|------------<---Start of Files or Arguments Needed-->---------------|
| Inputs:                                                            |
|   str  - the string you want to check;                             |
|   char - the character you want to find the position;              |
|------------------<---End of Arguments Needed-->--------------------|
|--------------------------------------------------------------------|
|------------------<---Start of Files Created-->---------------------|
| Usage: %indexc(str,chars);                                         |
\-------------------<---End of Files Created-->---------------------*/
%macro indexc(str,chars);
/*--------------------------------------------\
| Author:  Duo Zhou;                          |
| Created: 2-13-2002 9:30pm;                  |
| Purpose: Return the first position of a     |
|          character in the string;           |
\--------------------------------------------*/
%local i s;
%if %length(&chars) %then %do;
   %do i=1 %to %length(&str);
      %if %index(&chars,%qsubstr(&str,&i,1)) %then %goto exit;
   %end;
%end;
%let i=0;
%exit:
   &i
%put;
%mend indexc;